import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl
import pandas as pd
# 需要提前安装
# pip install pandas
# pip install openpyxl
mpl.rcParams['font.sans-serif']=['SimHei']#让中文可以正常显示
plt.rcParams['axes.unicode_minus']=False #让负号能够正常显示
data7=pd.read_excel('可视化图表.xlsx',sheet_name=7)
print(data7)
plt.figure()
plt.pie(data7['金额(万元)'],labels=list(data7['区域']),autopct='%.1f%%', textprops={'color':'r'},explode=[0.1,0,0,0],shadow=True,
startangle=90)
plt.legend(loc=1)
plt.show()
